package com.sskj.fca.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;
import com.sskj.fca.bean.OpenAwardBean;
import com.sskj.fca.ui.fragment.OpenAwardHistoryFragment;

import java.util.List;

import io.reactivex.Flowable;

public class OpenAwardHistoryFragmentPresenter extends BasePresenter<OpenAwardHistoryFragment> {

    /**
     * 开奖历史列表
     */
    public Flowable<List<OpenAwardBean>> getOpenAwardList(String account, int page, int size) {
        return httpService.openAwardList(account, page, size)
                .converter(new JsonConverter<HttpData<PageBean<OpenAwardBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(listHttpData -> listHttpData.getData().getList());
    }
//
//    /**
//     * 开奖历史列表
//     */
//    public Flowable<List<OpenAwardBean>> getOpenAwardList(String account, int page, int size) {
//        return httpService.openAwardList(account, page, size)
//                .converter(new JsonConverter<HttpData<PageBean<OpenAwardBean>>>() {
//                })
//                .adapt(new FlowableBody<>())
//                .map(listHttpData -> listHttpData.getData().getList());
//    }
}
